package com.example.weather

import android.os.Bundle
import android.view.LayoutInflater
import com.example.weather.base.BaseBindingActivity
import com.example.weather.databinding.ActivityWeatherScreenBinding
import com.example.weather.ui.AirQualityFragment
import com.example.weather.ui.DailyForecastFragment
import com.example.weather.ui.WeatherForecastFragment

class WeatherScreen : BaseBindingActivity<ActivityWeatherScreenBinding>() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        supportFragmentManager.beginTransaction()
            .add(binding.forecastContainer.id, DailyForecastFragment())
            .add(binding.airContainer.id, AirQualityFragment())
            .add(binding.weatherForecastContainer.id, WeatherForecastFragment())
            .commit()

        binding.btnControl.setOnClickListener {
            binding.city.text = "New York"
        }
    }

    override fun initBinding(layoutInflater: LayoutInflater): ActivityWeatherScreenBinding {
        return ActivityWeatherScreenBinding.inflate(layoutInflater)
    }
}